package cn.zd.demo1.webview;

import android.content.Context;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

import cn.zd.demo1.WebViewActivity;

public class MyChromeWebClient extends WebChromeClient {
    private Context context;
    private WebViewActivity.Callback callback;
    public MyChromeWebClient(Context context, WebViewActivity.Callback callback) {
        this.context = context;
        this.callback = callback;
    }

    @Override
    public void onProgressChanged(WebView view, int newProgress) {
        if(callback!=null) {
            callback.onProgressChanged(newProgress);
        }
        super.onProgressChanged(view, newProgress);
    }

    @Override
    public void onReceivedTitle(WebView view, String title) {
        if(callback!=null) {
            callback.setTitle(title);
        }
        super.onReceivedTitle(view, title);
    }


}
